<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreateBuildingsTable.
 */
class CreateBuildingsTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('buildings', function(Blueprint $table) {
            $table->increments('id');
            $table->string('block',10)->nullable();
            $table->unsignedInteger('dorm_type_id')->nullable();
            $table->string('name',20)->unique();
            $table->string('short_name',20)->nullable();
            $table->unsignedInteger('record_order')->default(0);
            $table->string('unit_name_type',20)->default('number');
            $table->tinyInteger('unit_count')->default(1);
            $table->integer('floors')->default(6);
            $table->tinyInteger('beds_per_room');
            $table->tinyInteger('rooms_per_floor')->default(6);
            $table->decimal('general_room_rent')->nullable();
            $table->string('gen_dorm_rule')->nullable();
            $table->string('remark',60)->nullable();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->useCurrent();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('buildings');
	}
}
